package willevaluate.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.example.xuegengwang.xuegengwang.R;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;


import common.BaseActivity;
import willevaluate.bean.ExpertEvaluateQuestionListBean;

/**
 * Created by Administrator on 2017/6/9.
 * 志愿填报问题详情
 */

@ContentView(R.layout.expert_evaluate_question_detail)
public class ExpertEvaluateQuestionDetail extends BaseActivity implements View.OnClickListener {
    @ViewInject(R.id.common_back)
    private ImageView common_back;
    @ViewInject(R.id.common_title)
    private TextView common_title;
    @ViewInject(R.id.expert_evaluate_question_detail_question)
    private TextView expert_evaluate_question_detail_question;
    @ViewInject(R.id.expert_evaluate_question_detail_question_time)
    private TextView expert_evaluate_question_detail_question_time;
    @ViewInject(R.id.expert_evaluate_question_detail_answer_layout)
    private LinearLayout expert_evaluate_question_detail_answer_layout;
    @ViewInject(R.id.expert_evaluate_question_detail_answer)
    private TextView expert_evaluate_question_detail_answer;
    @ViewInject(R.id.expert_evaluate_question_detail_answer_time)
    private TextView expert_evaluate_question_detail_answer_time;

    private ExpertEvaluateQuestionListBean.ListBean bean;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        bean = (ExpertEvaluateQuestionListBean.ListBean) getIntent().getSerializableExtra("questionDetail");
        initView();
    }


    private void initView() {
        common_back.setOnClickListener(this);
        common_title.setText("问题详情");
        if (bean != null) {
            expert_evaluate_question_detail_question.setText(bean.getQuestion());
            expert_evaluate_question_detail_question_time.setText(bean.getQuestion_time());
            if ("0".equals(bean.getStatus())) {
                //未回答
                expert_evaluate_question_detail_answer_layout.setVisibility(View.GONE);
                expert_evaluate_question_detail_answer_time.setVisibility(View.GONE);
            }else{
                expert_evaluate_question_detail_answer_layout.setVisibility(View.VISIBLE);
                expert_evaluate_question_detail_answer_time.setVisibility(View.VISIBLE);
                expert_evaluate_question_detail_answer.setText(bean.getAnswer());
                expert_evaluate_question_detail_answer_time.setText(bean.getAnswer_time());
            }
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.common_back:
                this.finish();
                break;
            default:
                break;
        }
    }
}
